package es

import (
	"github.com/olivere/elastic/v7"
)

//  -------------------------------------------- MustNot -------------------------------------------
// Term in MustNot
func (m *Model) MustNotTerm(fieldName string, value interface{}) *Model {
	return m.AddMustNot(elastic.NewTermQuery(fieldName, value))
}

// Terms in MustNot
func (m *Model) MustNotTerms(fieldName string, values ...interface{}) *Model {
	return m.AddMustNot(elastic.NewTermsQuery(fieldName, values...))
}

// Match in MustNot
func (m *Model) MustNotMatch(fieldName string, value interface{}) *Model {
	return m.AddMustNot(elastic.NewMatchQuery(fieldName, value))
}

// MatchPhrase in MustNot
func (m *Model) MustNotMatchPhrase(fieldName string, value interface{}) *Model {
	return m.AddMustNot(elastic.NewMatchPhraseQuery(fieldName, value))
}

// Range in MustNot
func (m *Model) MustNotRange(fieldName string, rangeOptions ...RangeOption) *Model {
	r := elastic.NewRangeQuery(fieldName)
	for _, rangeOption := range rangeOptions {
		rangeOption(r)
	}
	return m.AddMustNot(r)
}

// Exist in Must
func (m *Model) MustNotExist(fieldName string) *Model {
	return m.AddMustNot(elastic.NewExistsQuery(fieldName))
}